//---------------------------------------------------------------------------------
#ifndef __CASTAR_H__
#define __CASTAR_H__
//---------------------------------------------------------------------------------
#include <QList>
#include "CMap.h"
//---------------------------------------------------------------------------------
class CAStar {
	public:
		CAStar(CMap* map);
		bool goTo(int xSrc, int ySrc, int xDest, int yDest, QList<CMap::EAction> &actions);
	private:
		typedef bool (CMap::* pCMFunction)(int, int);
		
		CMap* map;
		int w, h;
		int size;
		int* buffer;
		int xDest, yDest;
		
		bool fillBuffer(int curValue=0);
		bool testMove(int xCur, int yCur, int xPlayer, int yPlayer, int idxBuffer, pCMFunction pFct, int newValue, bool& arrived);
};
//---------------------------------------------------------------------------------
#endif //__CASTAR_H__
//---------------------------------------------------------------------------------